package com.sky.controller.user;

import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.result.Result;
import com.sky.service.SetMealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userSetmealController")
@RequestMapping("/user/setmeal")
public class SetmealController {

    @Autowired
    private SetMealService setMealService;
    @GetMapping("/list")
    public Result<List<Setmeal>> list(Integer categoryId) {
        List<Setmeal> list = setMealService.getByCategroyId(categoryId);
        return Result.success(list);
    }

    @GetMapping("/dish/{id}")
    public Result<List<Dish>> dishList(@PathVariable Integer id) {
        List<Dish> list = setMealService.getDishBySetmealId(id);
        return Result.success(list);
    }
}
